/*
 * CommonElement.cpp
 *
 *  Created on: 2010-6-4
 *      Author: Guobc
 */

#include "CommonElement.h"

using namespace HA;

CommonElement::CommonElement() :
	HA::Element(), startTag(), endTag(), mName(){
}

CommonElement::CommonElement(ASTDom* document, int start, int end) :
	HA::Element(document, start, end), startTag(), endTag() {
}

string CommonElement::getText() {
	return toHTML();
}

string* CommonElement::getIds() const {
	return NULL;
}

string* CommonElement::getEnders() const {
	return NULL;
}

string CommonElement::toHTML() {
	string sb = "";
	sb += startTag.toHTML();
	ASTNodeList children = getChildren();
	int size = children.size();
	if (size > 0) {
//		sb += "\n";
		for (int i = 0; i < size; i++) {
			ASTNode* node = children.item(i);
			sb += node->toHTML();
		}
//		sb += "\n";
	}
	sb += endTag.toHTML();
	return sb;
}

CommonElement::~CommonElement() {
}

